package cn.itcast.bos.base.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.base.dao.StandardDao;
import cn.itcast.bos.base.service.StandardService;
import cn.itcast.bos.domain.base.Standard;


@Service
@Transactional(readOnly=false)
public class StandardServiceImpl implements StandardService{
	
	@Autowired
	private StandardDao standarddao;
	@Override
	@CacheEvict(value="standard",allEntries=true)
	public void addStandard(Standard standard) {
		// TODO Auto-generated method stub
		standarddao.save(standard);
	}
	@Override
	@Cacheable("standard")
	public Page<Standard> showStandard(Pageable pageable) {
		// TODO Auto-generated method stub
		return standarddao.findAll(pageable);
	}
	@Override
	@Cacheable("standard")
	public List<Standard> getAllstandard() {
		// TODO Auto-generated method stub
		return standarddao.findAll();
	}

}
